#include <iostream>
#include <map>

std::map<char, int> countCharacters(const std::string& str) {
    std::map<char, int> charCount;

    for (char c : str) {
        charCount[c]++;
    }

    return charCount;
}

int main() {
    std::string str = "Hello, world!";
    std::map<char, int> charCount = countCharacters(str);

    std::cout << "Character counts in the string:" << std::endl;
    for (auto it = charCount.begin(); it != charCount.end(); ++it) {
        std::cout << "'" << it->first << "': " << it->second << std::endl;
    }

    return 0;
}